package cn.lijiajia3515.cairo.example3.modules;

import cn.lijiajia3515.cairo.domain.CairoAccount;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping()
public class RestApi {
	@GetMapping("/authentication")
	@PreAuthorize("isAuthenticated()")
	public CairoAccount authentication(@AuthenticationPrincipal CairoAccount account, HttpServletRequest request, HttpServletResponse response) {
		return account;
	}

}
